package cn.wangzengqiang.study.designpattern.singleton;

/**
 * 懒汉式 双重校验锁
 */
public class LazyManDoubleCheckLockSingleton {
    private static LazyManDoubleCheckLockSingleton instance = null;

    private LazyManDoubleCheckLockSingleton() {
    }

    public static LazyManDoubleCheckLockSingleton getInstance() {
        if (instance == null) {
            synchronized (LazyManDoubleCheckLockSingleton.class) {
                if (instance == null) {
                    instance = new LazyManDoubleCheckLockSingleton();
                }
            }
        }
        return instance;
    }
}
